package com.fuluwa.domain.usercenter.model.competence;

import java.util.List;

import com.google.common.collect.Lists;

public abstract class AbstractCompetence extends AbstractComputer{
	private List<CompetenceSubDefine> subCategoryScores=Lists.newArrayList();
	private CompetenceType type;
	private LevelAdditionDefine levelAddtionDefine;
	
	
	
	//get level->addtion define.
	//get current level
	List<CompetenceSubDefine> findAll(){//find all sub competences from database,should.
		return subCategoryScores;
	}
	public void addCompetenceSubCategoryDefineScore(CompetenceSubDefine categoryDefineScore) {
		subCategoryScores.add(categoryDefineScore);
	}
	
	@Override
	public float compute() {
		float ret=0;
		// TODO Auto-generated method stub
		List<CompetenceSubDefine> subs= findAll();
		for (CompetenceSubDefine compSubDefineScore : subs) {
			ret+=compSubDefineScore.compute();
		}
		ret/=subs.size();
		
		ret*=(levelAddtionDefine.getAddtion()+1);
		
		return ret;
	}
	public void setType(CompetenceType type) {
		this.type = type;
	}
	public void setLevelAddtionDefine(LevelAdditionDefine levelAddtionDefine) {
		this.levelAddtionDefine = levelAddtionDefine;
	}
}